package com.example.sw.myapp10052;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.Switch;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.example.sw.myapp10052.Bean.Alamitem;

import org.w3c.dom.Text;

import java.util.List;

public class NaozhongAdapter3 extends ArrayAdapter<Alamitem> {

    private int rid;



    public NaozhongAdapter3(@NonNull Context context, int resource, @NonNull List<Alamitem> objects) {
        super(context, resource, objects);
        rid =resource;


    }

    @Override
    public View getView(int i, View view, ViewGroup parent){
        //布局
        View v= LayoutInflater.from(getContext()).inflate(rid,null);
        //控件实例化
        TextView textTime=v.findViewById(R.id.txtTime);
        Switch swbtn=v.findViewById(R.id.swbtn);

        Alamitem a=getItem(i);
        textTime.setText(a.getTime());
        swbtn.setChecked(a.isIschecked());

        return v;

    }

}
